﻿// Name: 流量统计器客户端
// Version: 0.0.0.0
// Copyright: ProgrammingCanRuinYourLife.cn

// 用法
// 在需要统计的页面上写上
// <script type="text/javascript">
//     clientID = "客户授权码";
// </script>
// <script type="text/javascript" src="http://console.themz.cn/statistics/collecting.js"></script>

// 以下是正式程序
//==================================================================================

(function(){

    // 客户端ID必须设置
    if( "undefined" == typeof(pcryl_stat_clientID) ){  return false;  }

    // 流量统计器地址
    var addr = "http://localhost/statistics/collecting.aspx";


    // 收集数据
    function collectingData()
    {
        var arry = new Array();
        var itemID = 0;
        var title = document.title;

        if( "undefined" != typeof(pcryl_stat_itemID) ){  itemID = pcryl_stat_itemID;  }
        if( "undefined" != typeof(pcryl_stat_title) ){  title = pcryl_stat_title;    }

        arry.push( "clientID=" + pcryl_stat_clientID );
        arry.push( "itemID="+ itemID );
        arry.push( "title=" + encodeURIComponent(title) );
        arry.push( "referrer=" + encodeURIComponent(document.referrer) );
        arry.push( "screenWidth=" + screen.width );
        arry.push( "screenHeight=" + screen.height );

        return arry;
    }

    // 发送数据
    function sendData( strArray )
    {
        document.write('<script type="text/javascript" src="'.concat(addr,"?",strArray.join("&"),"&time=",new Date(),'"></','script>') );
    }

    // 执行
    sendData( collectingData() );

})();